package cn.baiweigang.uu.enums;

import java.util.ArrayList;
import java.util.List;

public enum StockItemEnum {
    //行情指标
    OPEN("OPEN","开盘价","open_"),
    CLOSE("CLOSE","收盘价","close_"),
    HIGH("HIGH","最高价"),
    LOW("LOW","最低价"),
    PRECLOSE("PRECLOSE","前收盘价"),
    AVERAGE("AVERAGE","均价"),
    CHANGE("CHANGE","涨跌","change_"),
    PCTCHANGE("PCTCHANGE","涨跌幅"),
    HIGHLIMIT("HIGHLIMIT","是否涨停"),
    VOLUME("VOLUME","成交量"),
    AMOUNT("AMOUNT","成交金额"),
    TURN("TURN","换手率"),
    TRADESTATUS("TRADESTATUS","交易状态"),
    TNUM("TNUM","成交笔数"),
    LOWLIMIT("LOWLIMIT","是否跌停"),
    AMPLITUDE("AMPLITUDE","振幅"),
    BUYVOL("BUYVOL","内盘成交量"),
    SELLVOL("SELLVOL","外盘成交量"),

    //估值指标
    MV("MV","总市值"),
    PETTM("PETTM","市盈率(TTM)"),
    PE("PE","市盈率(PE)"),
    PB("PB","市净率(PB)"),
    LIQMV("LIQMV","自由流通市值"),
    PEDYNAMIC("PEDYNAMIC","动态市盈率"),

    //股本指标
    TOTALSHARE("TOTALSHARE","总股本"),
    FREELIQCISHARE("FREELIQCISHARE","自由流通股本"),
    HOLDNUM("HOLDNUM","股东户数"),

    //资金流向
    NETINVOLUME("NETINVOLUME","主力净流入量"),

    //融资融券
    SECLENDINGBALANCEM("SECLENDINGBALANCEM","融券余额"),
    TRADINGBALANCEM("TRADINGBALANCEM","融资余额"),
    PURCHASEWITHBORROWEDMONEYM("PURCHASEWITHBORROWEDMONEYM","融资买入额"),
    SALESOFBORROWEDSECM("SALESOFBORROWEDSECM","融券卖出量"),
    ;
    private String key;
    private String desc;
    private String colName;
    private String itemClass;

    StockItemEnum(String key, String desc) {
        this.key = key;
        this.desc = desc;
        this.colName = key.toLowerCase();
    }
    StockItemEnum(String key, String desc, String colName) {
        this.key = key;
        this.desc = desc;
        this.colName = colName;
    }

    public String getItemClass() {
        return itemClass;
    }

    public void setItemClass(String itemClass) {
        this.itemClass = itemClass;
    }

    public String getKey() {
        return key;
    }

    public void setKey(String key) {
        this.key = key;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getColName() {
        return colName;
    }

    public void setColName(String colName) {
        this.colName = colName;
    }

    public static List<StockItemEnum> getBaseInfoItem(){
        List<StockItemEnum> stockItemEnumList=new ArrayList<>();
        StockItemEnum[] stockItemEnums =values();
        for (int i=0;i< stockItemEnums.length;i++){
            if (stockItemEnums[i].getKey().equalsIgnoreCase("PB") ||
                    stockItemEnums[i].getKey().equalsIgnoreCase("PEDYNAMIC")){
                //这2个指标单独处理
            }else {
                stockItemEnumList.add(stockItemEnums[i]);
            }
        }
        return stockItemEnumList;
    }
    public static StockItemEnum getStockItemByKey(String key){
        StockItemEnum[] stockItemEnumList =values();
        for (int i=0;i< stockItemEnumList.length;i++){
            if (key!=null && key.equalsIgnoreCase(stockItemEnumList[i].getKey())){
                return stockItemEnumList[i];
            }
        }
        return null;
    }
}
